import React, { useState } from 'react'
import { Radio } from 'antd';
import styles from '../../styles/login/identifySelect.scss'
import { changeInputDataConfig } from './Login';

interface identifySelectConfig {
    type: string,
    callback: changeInputDataConfig
}

export default function IdentifySelect({ type, callback }: identifySelectConfig) {
    const [radioValue, setRadioValue] = useState('学生')
    const onChange = e => {
        setRadioValue(e.target.value)
        callback(e.target.value, type); // 改变时发送数据到注册页面
    };
    return (
        <div className={styles.main}>
            <Radio.Group onChange={onChange} defaultValue={radioValue}>
                <Radio.Button value="学生">学生</Radio.Button>
                <Radio.Button value="教师">教师</Radio.Button>
            </Radio.Group>
        </div>
    )
}
